Repository navigation
plugin-askrene: cap dial iterations to avoid redundant solver runs - #9735
aryarathoree wants to merge 1 commit into
Conversation
4f03416 to
70226f7
Compare
|
Concept ACK. |
|
Thanks for the feedback! I've addressed @Andezion's review by introducing @Lagrang3, I agree that increasing the step size near the tails makes sense, since Would you prefer to land this cap first, or should we adjust the dial step function directly in this PR? |
Andezion
left a comment
There was a problem hiding this comment.
Did you run test_real_data and test_real_biases locally? Do their expected values still hold? Did you think about bigger steps above 0.95 instead of a hard cap (the other option in the issue)? For example, mu = 0.95, 0.99, 0.999 would still reach the cheaper solutions in 2-3 extra runs
Also should max_mu be a #define near SINGLE_PATH_THRESHOLD, or stay a local const? Local is fine for me, im only asking for consistency with #9723, which touches the same loop
| # Dial iterations cut off once mu >= 0.99, bounding solver runs (issue #9726) | ||
| l1.daemon.logs_catchup() | ||
| mu_retries = [l for l in l1.daemon.logs if "retrying with mu of" in l] | ||
| assert 0 < len(mu_retries) <= 15 |
There was a problem hiding this comment.
maybe
l1.daemon.wait_for_log(r"retrying with mu of 0\.993994")
assert len([l for l in l1.daemon.logs if "retrying with mu of" in l]) == 14
The retry loop around the solver in linear_routes() repeatedly doubles the odds mu / (1 - mu) when the route fee exceeds maxfee. Previously, the cut-off was set to `near_one = 1. - 1e-6`, requiring 27 retries (28 solver runs) before failing. As reported in ElementsProject#9726: "The 17 added runs are at mu above 0.95, where a run is slower and the fee found changes little or rises... Effect on a mainnet node that rebalances with a tight fee budget, v26.06.10 against v26.06.9: the median rebalance request takes 26 s against 5 s, and 12.8% of them end in the timeout (askrene-timeout 30); none did before." Introduce `max_mu = 0.99` to cap mu iterations while keeping `near_one = 1. - 1e-6` for delay/hop dials and the flow_fee_adjustment fallback. This bounds the maximum number of solver attempts to 15, avoiding the diminishing-returns iterations above mu=0.95 where fee priority is already ~99% and MCF solver passes become significantly more expensive without improving found fees. Fixes ElementsProject#9726 Changelog-Fixed: askrene: bound dial iterations to avoid redundant solver runs when fee exceeds budget.
70226f7 to
9f5402e
Compare
|
There are some CI tests failures that don't appear to be flakes, please fix these. |
Problem
As reported in #9726 by @ksedgwic, when no route fits
maxfee,linear_routes()inplugins/askrene/child/mcf.cexecutes 28 solver runs before failing.The 17 runs above (\mu = 0.95) (up to
near_one = 1. - 1e-6) can take up to 10× longer on mainnet nodes without improving the found fees. This frequently causes callers with tight fee budgets (e.g. rebalancers) to hitaskrene-timeout.Solution
Cap
near_oneat0.99. This limits the solver loop to at most 15 runs, cutting off the slow iterations with diminishing returns above (\mu = 0.95) and avoiding unnecessary timeouts.Fixes #9726
Checklist
Changelog-Fixed:).#9726).tools/lightning-downgrade(N/A, internal heuristic).